﻿Ext.extend(NExt.form.ComboBox, Ext.form.ComboBox, {
    getModel: function() {
        var value = this.getValue();
        var record = this.findRecord(this.valueField, value);
        if (!Ext.isEmpty(record)) {
            var model = record.data;
            return model;
        }
        
        if (!Ext.isDefined(this.model)) {
            this.model = {};
        }
        
        return this.model;
    },

    setModel: function(model) {
        this.model = model;
        var value = this.model[this.valueField];
        this.setValue(value);
    }
});